package com.lijiajian.task;

import com.lijiajian.Service.CustomerService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class JobTask {
    @Resource
    private CustomerService customerService;
    //每个月的一号凌晨两点修改一次客户流失记录
    @Scheduled(cron="0 0 2 1 * ?")
    public void job(){
        System.out.println("定时任务开始执行-->"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
        customerService.updateCustomerState();
    }

}
